/**
 * 
 */
package com.lehecai.core.api.user;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

/**
 * 白名单类型
 * @author He Wang
 *
 */
public class WithdrawWhitelistType extends IntegerBeanLabelItem {


	private static final long serialVersionUID = -160758782887835781L;

	private static final Logger logger = LoggerFactory.getLogger(WithdrawWhitelistType.class.getName());
	
	private static List<WithdrawWhitelistType> items = new ArrayList<WithdrawWhitelistType>();
	private static List<WithdrawWhitelistType> queryItems = new ArrayList<WithdrawWhitelistType>();
	
	
	
	protected WithdrawWhitelistType(String name, int value, boolean queryOnly) {
		super(WithdrawWhitelistType.class.getName(), name, value);
		queryItems.add(this);
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	protected WithdrawWhitelistType(String name, int value) {
		this(name, value, false);
	}
	
	public static WithdrawWhitelistType getItem(int value){
		try {
			return (WithdrawWhitelistType)WithdrawWhitelistType.getResult(WithdrawWhitelistType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<WithdrawWhitelistType> getItems() {
		return items;
	}
	
	public static List<WithdrawWhitelistType> getItemsForQuery() {
		return queryItems;
	}
	
	public static final WithdrawWhitelistType ALL = new WithdrawWhitelistType("全部", -1, true);
	public static final WithdrawWhitelistType USERNAME = new WithdrawWhitelistType("用户名", 1);
}
